<?php

namespace app\api\model\gifts;

use app\common\model\GiftsOrderGoods as GiftsOrderGoodsModel;
use think\Db;

/**
 * 订单商品模型
 * Class OrderGoods
 * @package app\store\model
 */
class GiftsOrderGoods extends GiftsOrderGoodsModel
{

    protected $updateTime = false;
    /**
     * 新增记录
     * @param $orderId
     * @param $data
     * @return false|int
     */
    public function add($orderId, $data,$user_id)
    {
        $data = [
            'order_id' => $orderId,//订单id
            'user_id' => $user_id,//用户id
            'gifts_id' => $data['gifts_id'],//商品id
            'gifts_title' => $data['gifts_title'],//爆品礼包名称
            'gifts_type' => $data['gifts_type'],//爆品礼包类型(10免费 20不免费)
            'image_id' => $data['image_id'],//爆品礼包图片
            'gifts_line_price' => $data['gifts_line_price'],//划线价
            'gifts_price' => $data['gifts_price'],//现价
            'gifts_distribution_price' => $data['gifts_distribution_price'],//爆品礼物分销价格
            'gifts_discription' => $data['gifts_discription'],//爆品简介
            'gifts_content' => $data['gifts_content'],//爆品详情
            'start_time' => $data['start_time']['value'],//固定时间-开始时间
            'end_time' => $data['end_time']['value'],//固定时间-结束时间
            'linkman' => $data['linkman'],//店铺联系人
            'phone' => $data['phone'],//联系电话
            'address' => $data['address'],//联系地址
            'wxapp_id' => self::$wxapp_id,//小程序id
            'create_time' => time(),//小程序id
        ];
        $gifts_order_goods_id = Db::name('gifts_order_goods')->insertGetId($data);
        return $gifts_order_goods_id;
    }

}
